package com.example.springboot.service.impl;

import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.springboot.entity.Type;
import com.example.springboot.entity.User;
import com.example.springboot.entity.request.BaseRequest;
import com.example.springboot.entity.request.LoginRequest;
import com.example.springboot.entity.request.PasswordRequest;
import com.example.springboot.entity.request.TypePageRequest;
import com.example.springboot.exception.ServiceException;
import com.example.springboot.mapper.TypeMapper;
import com.example.springboot.mapper.UserMapper;
import com.example.springboot.service.TypeService;
import com.example.springboot.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 程序员小洋
 * @version 2022.3
 * @date 2022/12/8 11:38
 * @title UserService的业务层
 */
@Service
@Slf4j
public class TypeServiceImpl extends ServiceImpl<TypeMapper, Type>implements TypeService {

    @Autowired
    private TypeMapper typeMapper;

    @Override
    public PageInfo<Type> pageInfo(BaseRequest baseRequest) {
        PageHelper.startPage(baseRequest.getPageNum(), baseRequest.getPageSize());
        List<Type> types = typeMapper.listByCondition(baseRequest);
        return new PageInfo<>(types);
    }
}
